package com.example.lotteryticketdev.config;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;


@Configuration
@PropertySource(value = {"classpath:application.yml"}, encoding = "UTF-8")//读取配置文件
@ConfigurationProperties(prefix="sgq.email")//读取节点
public class ConstantPropertiesForEmail implements InitializingBean {

    @Value("${host}")
    private String host;

    @Value("${mail}")
    private String mail;

    @Value("${password}")
    private String password;

    @Value("${protocol}")
    private String protocol;

    @Value("${target}")
    private String target;

    @Value("${title}")
    private String title;

    public static String HOST;
    public static String MAIL;
    public static String PASSWORD;
    public static String TRANSPORT_PROTOCOL;
    public static String TARGET;
    public static String TITLE;


    @Override
    public void afterPropertiesSet() throws Exception {
        HOST = host;
        MAIL = mail;
        PASSWORD = password;
        TRANSPORT_PROTOCOL = protocol;
        TARGET = target;
        TITLE = title;
    }
}